#include "QtWidgetsApplication.h"
using namespace std;

QtWidgetsApplication::QtWidgetsApplication(QWidget *parent)
    : QMainWindow(parent)
{
    ui.setupUi(this);
	connect(ui.Submit, &QPushButton::clicked, this, &QtWidgetsApplication::Submit);
    connect(ui.Show, &QPushButton::clicked, this, &QtWidgetsApplication::Show);
    connect(ui.Clear, &QPushButton::clicked, this, &QtWidgetsApplication::Clear);
}

map<QString, QString> dic;

void QtWidgetsApplication::Submit()
{
    dic["Card"] = ui.Card->toPlainText();
    dic["Name"] = ui.Name->toPlainText();
    dic["Score"] = ui.Score->toPlainText();

}

void QtWidgetsApplication::Show()
{
    ui.Info->setText(QString::fromStdString(
        "Card: " + dic["Card"].toStdString() + "\n" +
        "Name: " + dic["Name"].toStdString() + "\n" +
        "Score: " + dic["Score"].toStdString()));
     //  ui.sjo.setText(QString::fromStdString(dic["Card"].toStdString() + "\n" + dic["Name"].toStdString() + "\n" + dic["Score"].toStdString()));
}


void QtWidgetsApplication::Clear()
{
    ui.Card->clear();

    ui.Name->clear();

    ui.Score->clear();
    ui.Info->clear();

}
QtWidgetsApplication::~QtWidgetsApplication()
{}

